/*
 *   Copyright (c) 2010-2022, SIUFUNG
 */
package net.siufung.market.base.dict.controller.model.dicttype;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.siufung.core.model.AbstractVo;
import net.siufung.core.model.enums.DefaultEnum;
import net.siufung.market.base.dict.controller.model.dict.DictVo;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author 陈建峰
 * @since 2022-07-08 15:30:16
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="DictTypeVo", description="字典类型")
public class DictTypeVo extends AbstractVo {

    private static final long serialVersionUID = -1029898160310034817L;
    /**
     * 字典id
     */
    @ApiModelProperty(value = "字典id")
    private Integer id;

    /**
     * 字典类型编码
     */
    @ApiModelProperty(value = "字典类型编码")
    private String typeCode;

    /**
     * 字典类型名称
     */
    @ApiModelProperty(value = "字典类型名称")
    private String typeName;

    /**
     * 默认状态
     */
    @ApiModelProperty(value = "默认状态")
    private Boolean defaultFlag;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    private String description;

    /**
     * 租户
     */
    @ApiModelProperty(value = "租户")
    private String tenantId;

    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    private String createdBy;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
    private LocalDateTime createdAt;

    /**
     * 更新人
     */
    @ApiModelProperty(value = "更新人")
    private String updatedBy;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
    private LocalDateTime updatedAt;

    /**
     * 数据标识
     */
    @ApiModelProperty(value = "数据标识")
    private Boolean deleted;

    /**
     * 字典类型列表
     */
    private List<DictVo> dictVoList;

    /**
     * 默认状态
     */
    public String getDefaultFlagDesc(){
        return DefaultEnum.get(defaultFlag).getDesc();
    };



}